package com.shop.cereshop.admin.service.versions.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shop.cereshop.admin.dao.versions.CereAgreementDAO;
import com.shop.cereshop.admin.service.versions.CereAgreementService;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.versions.CereAgreement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

@Service
public class CereAgreementServiceImpl extends ServiceImpl<CereAgreementDAO, CereAgreement>  implements CereAgreementService {
    @Autowired
    private CereAgreementDAO cereAgreementDAO;
    @Override
    public Page<CereAgreement> getPage(Integer pageNum, Integer pageSize, String verSionType, Long contentId) {
//   设置分页参数
        PageHelper.startPage(pageNum, pageSize);
        List <CereAgreement>  cereAgreement=cereAgreementDAO.selectPageByIdOrName(verSionType,contentId);

        PageInfo<CereAgreement> cereAgreementPageInfo = new PageInfo<>(cereAgreement);
        Page<CereAgreement> cereAgreementPage = new Page<>(cereAgreementPageInfo.getList(), cereAgreementPageInfo.getTotal());
        return cereAgreementPage;
    }
}
